package gui;

import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JSeparator;

public abstract class AbstractViewPane extends JPanel {
	
	public enum ViewMode { CONSULTATION, MODIFICATION, AJOUT };

	
	public AbstractViewPane() {
		this.setLayout(new BorderLayout());
		
		setBorder(BorderFactory.createCompoundBorder(
		BorderFactory.createTitledBorder(getTitle()),
		BorderFactory.createEmptyBorder(5,5,5,5)));
	}
	
	public void drawCommandBox(JPanel commandBox) {
        JPanel buttonPanel = new JPanel(new BorderLayout());
        buttonPanel.add(new JSeparator(), BorderLayout.PAGE_START);
        buttonPanel.add(commandBox, BorderLayout.LINE_END);
        
        add(buttonPanel, BorderLayout.SOUTH);
	}
	
	public abstract String getTitle();
	
	/**
	 * Permet de déterminer s'il est nécessaire de demander à l'utilisateur
	 * une confirmation de fermeture de la vue.
	 * @return true si la vue contient des modifications non enregistrées, false sinon.
	 */
	public abstract boolean hasBeenModified();
}
